import type { App } from 'vue'
import { createPinia } from 'pinia'
import { createPersistedState } from 'pinia-plugin-persistedstate'

const pinia = createPinia()

pinia.use(createPersistedState({
  storage: { getItem: uni.getStorageSync, setItem: uni.setStorageSync },
}))

export function setupStore(app: App<Element>) {
  app.use(pinia)
}

export default pinia

// 导出所有模块
export * from './app'
